package com.zhongpengcheng.blog.exception;

import com.zhongpengcheng.blog.enums.ResultCodeEnum;
import lombok.Getter;

/**
 * 基础带ResultCode的错误
 * note: 1.记录变更 by zhongpengcheng
 *
 * @author zhongpengcheng
 * @date 2021/08/26 15:54
 **/
public abstract class BaseResultCodeException extends RuntimeException {
    private static final long serialVersionUID = -3042686055658047215L;

    @Getter
    private final ResultCodeEnum resultCode;

    public BaseResultCodeException() {
        this(ResultCodeEnum.FAILED);
    }

    public BaseResultCodeException(ResultCodeEnum resultCode) {
        super(resultCode.getMsg());
        this.resultCode = resultCode;
    }
}
